Create database Restaurant

go

use Restaurant

go

Create table Users
(
	userId int identity(1,1) primary key not null,
	username nvarchar(50) not null,
	password nvarchar(50) not null
)
go
Create table Food
(
	foodId int identity(1,1) primary key not null,
	name nvarchar(50) not null,
	price float not null,
	description nvarchar(MAX),
	linkImage varchar(MAX)
)
go
Create table Menu
(
	menuId int identity(1,1) primary key not null,
	name nvarchar(50) not null,
	description nvarchar(MAX)
)
go
Create table MenuItem
(
	menuItemId int identity(1,1) primary key not null,
	menuId int not null,
	foodId int not null
)
go
ALTER TABLE MenuItem
   ADD CONSTRAINT FK_Menu 
      FOREIGN KEY (menuId)
      REFERENCES Menu(menuId)
	  ON UPDATE CASCADE
      ON DELETE CASCADE
go
ALTER TABLE MenuItem
   ADD CONSTRAINT FK_Food
      FOREIGN KEY (foodId)
      REFERENCES Food(foodId)
	  ON UPDATE CASCADE
      ON DELETE CASCADE
GO
insert into users values('admin','admin')